class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        unordered_map<int,int> u1;
        for(int i = 0;i<nums.size();i++)
        {
            auto it = u1.find(target-nums[i]);
            if(it != u1.end())
            {
                return {i,it->second};
            }else
            {
                u1[nums[i]] = i;
            }
        }
        return {};
    }
};